/*
 * MainView.java
 *
 * Created on Dec 18, 2010, 2:15:52 PM
 */
package main;

import com.nanosl.lib.db.Manager;
import com.nanosl.lib.ui.Bg;
import ent.Menu;
import ent.MenuItem;
import ent.MenuItemPK;
import ent.Operator;
import ent.ViewPanel;
import java.awt.Color;
import java.awt.Component;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import ui.CompanyView;
import ui.CostPriceChangeView;
import ui.CustomerView;
import ui.DamageNotesView;
import ui.DamageStockView;
import ui.EmployeeView;
import ui.ExpensesPayView;
import ui.FindInvoiceView;
import ui.ItemView;
import ui.POS;
import ui.PurchaseInvoicePaymentView;
import ui.PurchaseInvoiceView;
import ui.SaleInvoicePaymentView;
import ui.SaleInvoiceView;
import ui.SelingPriceChangeView;
import ui.StockChangeView;
import ui.StockTransferView;
import ui.StockView;
import ui.SubDealerView;
import ui.SupplierView;
import ui.operator.OperatorView;
import ui.operator.PermissionView;
import ui.rep.RepPriceChangeView;
import ui.rep.RepRemainingStockView;
import ui.rep.RepReturnView;
import ui.rep.RepSaleView;
import ui.rep.RepStockChangeView;
import ui.rep.RepStockView;
import ui.report.AveragePriceView;
import ui.report.CollectionReportView;
import ui.report.ExpensesReportView;
import ui.report.IssuedChequeReportView;
import ui.report.ItemMovementView;
import ui.report.MonthReportView;
import ui.report.PartPaymentCollectionReportView;
import ui.report.PaymentReportView;
import ui.report.ProfitSummeryView;
import ui.report.ProfitView;
import ui.report.PurchaseReportView;
import ui.report.ReceivedChequeReportView;
import ui.report.RepSaleReportView;
import ui.report.SalesReportView;
import ui.report.StockChangeReportView;
import ui.report.TransferReportView;
import ui.tool.BankView;
import ui.tool.EmployeePositionView;
import ui.tool.ItemTypeView;
import ui.tool.MenuManageView;
import ui.tool.RootAreaView;
import ui.tool.TownView;
import util.Data;
import util.Init;

/**
 *
 * @author t
 */
public class MainView extends com.nanosl.lib.ui.NFrame {

    private static MainView instance = new MainView();
    protected Manager m = Manager.getInstance();

    public static MainView getInstance() {
        return instance;
    }

    public static void display() {
        instance.setVisible(true);
    }
    int swith = Toolkit.getDefaultToolkit().getScreenSize().width;
    JPanel mainImagePanel, mainClogoPanel, leftImgPanel;
    ImageIcon mainImageIcon = new ImageIcon(getClass().getResource("/img/mainPanel.png"));
    ImageIcon mainImageIconBig = new ImageIcon(getClass().getResource("/img/mainPanelBig.png"));
    ImageIcon leftImgIcon = new ImageIcon(getClass().getResource("/img/lPanel.png"));
    ImageIcon mainClogoIcon = new ImageIcon(getClass().getResource("/img/nano160.png"));

    /**
     * Creates new form MainView
     *///img/mainPanel.png
    public MainView() {
        if (swith < 1100) {
            mainImagePanel = Bg.getBg(mainImageIcon);
        } else {
            mainImagePanel = Bg.getBg(mainImageIconBig);
        }
        mainClogoPanel = new JPanel();//Bg.getBg(mainClogoIcon);
        leftImgPanel = Bg.getBg(leftImgIcon);
        initComponents();
        onLoad();
    }

    @Override
    protected void onLoad() {
        super.onLoad();
        operatorLabel.setText(Data.getOperator().getUsername());
        createPopupMenu();
        menuRegister();
    }
    //==========Popup====================
    JPopupMenu popupMenu;
    JMenuItem popupMenuItem;

    private void createPopupMenu() {
        popupMenu = new JPopupMenu();
        popupMenuItem = new JMenuItem("Purchase");
        popupMenu.add(popupMenuItem);
        popupMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                purchaseInvoiceMenuItemActionPerformed(e);
            }
        });
        popupMenuItem = new JMenuItem("Refresh");
        popupMenu.add(popupMenuItem);
        popupMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Manager.getInstance().clearCache();
                setValidationMessage("System Refreshed", Color.GREEN);
            }
        });
        popupMenuItem = new JMenuItem("Sales");
        popupMenu.add(popupMenuItem);
        popupMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                saleInvoiceMenuItemActionPerformed(e);
            }
        });
        popupMenuItem = new JMenuItem("POS");
        popupMenu.add(popupMenuItem);
        popupMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                posMenuItemActionPerformed(e);
            }
        });
        popupMenuItem = new JMenuItem("Stock");
        popupMenu.add(popupMenuItem);
        popupMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                stockStatusMenuItemActionPerformed(e);
            }
        });
        popupMenuItem = new JMenuItem("Transfer");
        popupMenu.add(popupMenuItem);
        popupMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                stockTransferMenuItemActionPerformed(e);
            }
        });
        popupMenuItem = new JMenuItem("Exit");
        popupMenu.add(popupMenuItem);
        popupMenuItem.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                exitMenuItemActionPerformed(e);
            }
        });
        addMouseListener(mouseAdapter);
    }
    MouseAdapter mouseAdapter = new MouseAdapter() {
        public void mouseReleased(MouseEvent Me) {
            if (Me.isPopupTrigger()) {
                popupMenu.show(Me.getComponent(), Me.getX(), Me.getY());
            }
        }
    };
    //==========End Popup====================

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        statusMessageLabel = new javax.swing.JLabel();
        detailsLabel = new javax.swing.JLabel();
        mainPanel = mainImagePanel;
        leftPanel = leftImgPanel;
        operatorLabel = new javax.swing.JLabel();
        operatorLabel1 = new javax.swing.JLabel();
        cLogoPanel = mainClogoPanel;
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        companyMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        purchaseMenu = new javax.swing.JMenu();
        purchaseInvoiceMenuItem = new javax.swing.JMenuItem();
        purchaseInvoicePaymentMenuItem = new javax.swing.JMenuItem();
        stockMenu = new javax.swing.JMenu();
        stockStatusMenuItem = new javax.swing.JMenuItem();
        stockTransferMenuItem = new javax.swing.JMenuItem();
        stockChangeMenuItem = new javax.swing.JMenuItem();
        damageStockMenuItem = new javax.swing.JMenuItem();
        salesMenu = new javax.swing.JMenu();
        saleInvoiceMenuItem = new javax.swing.JMenuItem();
        saleInvoicePaymentMenuItem = new javax.swing.JMenuItem();
        posMenuItem = new javax.swing.JMenuItem();
        destributionMenu = new javax.swing.JMenu();
        repStockMenuItem = new javax.swing.JMenuItem();
        repRemainingStockMenuItem = new javax.swing.JMenuItem();
        repSalesMenuItem = new javax.swing.JMenuItem();
        repStockChangeMenuItem = new javax.swing.JMenuItem();
        repStockReturnMenuItem = new javax.swing.JMenuItem();
        itemMenu = new javax.swing.JMenu();
        itemDetailsMenuItem = new javax.swing.JMenuItem();
        itemSellingPriceChangeMenuItem = new javax.swing.JMenuItem();
        repPriceChangeMenuItem = new javax.swing.JMenuItem();
        itemCostPriceChangeMenuItem = new javax.swing.JMenuItem();
        itemTypeMenuItem = new javax.swing.JMenuItem();
        reportMenu = new javax.swing.JMenu();
        stockTransferReportMenuItem = new javax.swing.JMenuItem();
        repSalesReportMenuItem = new javax.swing.JMenuItem();
        stockChangeReportMenuItem = new javax.swing.JMenuItem();
        purchaseSummaryMenuItem = new javax.swing.JMenuItem();
        salesSummaryMenuItem = new javax.swing.JMenuItem();
        paymentSummaryMenuItem = new javax.swing.JMenuItem();
        expensesReportMenuItem = new javax.swing.JMenuItem();
        collectionSummaryMenuItem = new javax.swing.JMenuItem();
        averagePriceMenuItem = new javax.swing.JMenuItem();
        damageNotesMenuItem = new javax.swing.JMenuItem();
        issuedChequeReportMenuItem = new javax.swing.JMenuItem();
        receivedChequeReportMenuItem = new javax.swing.JMenuItem();
        itemMovementsMenuItem = new javax.swing.JMenuItem();
        saleProfitMenuItem = new javax.swing.JMenuItem();
        profitSummeryMenuItem = new javax.swing.JMenuItem();
        monthMenuItem = new javax.swing.JMenuItem();
        printInvoiceMenuItem = new javax.swing.JMenuItem();
        partPaymentCollectionReportMenuItem = new javax.swing.JMenuItem();
        commonMenu = new javax.swing.JMenu();
        supplierMenuItem = new javax.swing.JMenuItem();
        subDealerMenuItem = new javax.swing.JMenuItem();
        ExpensesPayMenuItem = new javax.swing.JMenuItem();
        customerMenuItem = new javax.swing.JMenuItem();
        employeeMenuItem = new javax.swing.JMenuItem();
        employeePositionMenuItem = new javax.swing.JMenuItem();
        bankMenuItem = new javax.swing.JMenuItem();
        townMenuItem = new javax.swing.JMenuItem();
        rootAreaMenuItem = new javax.swing.JMenuItem();
        operatorMenuItem = new javax.swing.JMenuItem();
        permissionMenuItem = new javax.swing.JMenuItem();
        menuManageMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("CBIS BY NANO CREATIONS");
        setIconImage(new ImageIcon(getClass().getResource("/img/nanoSLogo.png")).getImage());

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 634, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 556, Short.MAX_VALUE)
        );

        //jPanel1 = new MainPanel();

        leftPanel.setOpaque(false);

        operatorLabel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        operatorLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        operatorLabel.setText("Operator");

        operatorLabel1.setFont(new java.awt.Font("Tahoma 12", 1, 12)); // NOI18N
        operatorLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        operatorLabel1.setText("Operator");

        cLogoPanel.setOpaque(false);

        javax.swing.GroupLayout cLogoPanelLayout = new javax.swing.GroupLayout(cLogoPanel);
        cLogoPanel.setLayout(cLogoPanelLayout);
        cLogoPanelLayout.setHorizontalGroup(
            cLogoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 190, Short.MAX_VALUE)
        );
        cLogoPanelLayout.setVerticalGroup(
            cLogoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 264, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout leftPanelLayout = new javax.swing.GroupLayout(leftPanel);
        leftPanel.setLayout(leftPanelLayout);
        leftPanelLayout.setHorizontalGroup(
            leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, leftPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cLogoPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(operatorLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
                    .addComponent(operatorLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE))
                .addContainerGap())
        );
        leftPanelLayout.setVerticalGroup(
            leftPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(leftPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(cLogoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(operatorLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(operatorLabel)
                .addContainerGap(226, Short.MAX_VALUE))
        );

        fileMenu.setText("File");
        fileMenu.setName("fileMenu"); // NOI18N

        companyMenuItem.setText("Company");
        companyMenuItem.setName("companyMenuItem"); // NOI18N
        companyMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                companyMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(companyMenuItem);

        exitMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, java.awt.event.InputEvent.ALT_MASK));
        exitMenuItem.setText("Exit");
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        purchaseMenu.setText("Purchase");
        purchaseMenu.setName("purchaseMenu"); // NOI18N

        purchaseInvoiceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F4, 0));
        purchaseInvoiceMenuItem.setText("Purchase Invoice");
        purchaseInvoiceMenuItem.setName("purchaseInvoiceMenuItem"); // NOI18N
        purchaseInvoiceMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                purchaseInvoiceMenuItemActionPerformed(evt);
            }
        });
        purchaseMenu.add(purchaseInvoiceMenuItem);

        purchaseInvoicePaymentMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F5, 0));
        purchaseInvoicePaymentMenuItem.setText("Purchase Invoice Payment");
        purchaseInvoicePaymentMenuItem.setName("purchaseInvoicePaymentMenuItem"); // NOI18N
        purchaseInvoicePaymentMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                purchaseInvoicePaymentMenuItemActionPerformed(evt);
            }
        });
        purchaseMenu.add(purchaseInvoicePaymentMenuItem);

        menuBar.add(purchaseMenu);

        stockMenu.setText("Stock");
        stockMenu.setName("stockMenu"); // NOI18N

        stockStatusMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F6, 0));
        stockStatusMenuItem.setText("Stock Status");
        stockStatusMenuItem.setName("stockStatusMenuItem"); // NOI18N
        stockStatusMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stockStatusMenuItemActionPerformed(evt);
            }
        });
        stockMenu.add(stockStatusMenuItem);

        stockTransferMenuItem.setText("Stock Transfer");
        stockTransferMenuItem.setName("stockTransferMenuItem"); // NOI18N
        stockTransferMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stockTransferMenuItemActionPerformed(evt);
            }
        });
        stockMenu.add(stockTransferMenuItem);

        stockChangeMenuItem.setText("Stock Change");
        stockChangeMenuItem.setName("stockChangeMenuItem"); // NOI18N
        stockChangeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stockChangeMenuItemActionPerformed(evt);
            }
        });
        stockMenu.add(stockChangeMenuItem);

        damageStockMenuItem.setText("Damage Stock");
        damageStockMenuItem.setName("damageStockMenuItem"); // NOI18N
        damageStockMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                damageStockMenuItemActionPerformed(evt);
            }
        });
        stockMenu.add(damageStockMenuItem);

        menuBar.add(stockMenu);

        salesMenu.setText("Sales");
        salesMenu.setName("salesMenu"); // NOI18N

        saleInvoiceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F2, 0));
        saleInvoiceMenuItem.setText("Sale Invoice");
        saleInvoiceMenuItem.setName("saleInvoiceMenuItem"); // NOI18N
        saleInvoiceMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saleInvoiceMenuItemActionPerformed(evt);
            }
        });
        salesMenu.add(saleInvoiceMenuItem);

        saleInvoicePaymentMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F3, 0));
        saleInvoicePaymentMenuItem.setText("Sale Invoice Payment");
        saleInvoicePaymentMenuItem.setName("saleInvoicePaymentMenuItem"); // NOI18N
        saleInvoicePaymentMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saleInvoicePaymentMenuItemActionPerformed(evt);
            }
        });
        salesMenu.add(saleInvoicePaymentMenuItem);

        posMenuItem.setText("POS");
        posMenuItem.setName("posMenuItem"); // NOI18N
        posMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                posMenuItemActionPerformed(evt);
            }
        });
        salesMenu.add(posMenuItem);

        menuBar.add(salesMenu);

        destributionMenu.setText("Destribution");
        destributionMenu.setName("destributionMenu"); // NOI18N

        repStockMenuItem.setText("Rep Stock");
        repStockMenuItem.setName("repStockMenuItem"); // NOI18N
        repStockMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repStockMenuItemActionPerformed(evt);
            }
        });
        destributionMenu.add(repStockMenuItem);

        repRemainingStockMenuItem.setText("Rep Remaining");
        repRemainingStockMenuItem.setName("repRemainingStockMenuItem"); // NOI18N
        repRemainingStockMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repRemainingStockMenuItemActionPerformed(evt);
            }
        });
        destributionMenu.add(repRemainingStockMenuItem);

        repSalesMenuItem.setText("Rep Sales");
        repSalesMenuItem.setName("repSalesMenuItem"); // NOI18N
        repSalesMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repSalesMenuItemActionPerformed(evt);
            }
        });
        destributionMenu.add(repSalesMenuItem);

        repStockChangeMenuItem.setText("Rep Stock Change");
        repStockChangeMenuItem.setName("repStockChangeMenuItem"); // NOI18N
        repStockChangeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repStockChangeMenuItemActionPerformed(evt);
            }
        });
        destributionMenu.add(repStockChangeMenuItem);

        repStockReturnMenuItem.setText("Rep Stock Return");
        repStockReturnMenuItem.setName("repStockReturnMenuItem"); // NOI18N
        repStockReturnMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repStockReturnMenuItemActionPerformed(evt);
            }
        });
        destributionMenu.add(repStockReturnMenuItem);

        menuBar.add(destributionMenu);

        itemMenu.setText("Item");
        itemMenu.setName("itemMenu"); // NOI18N

        itemDetailsMenuItem.setText("Item Details");
        itemDetailsMenuItem.setName("itemDetailsMenuItem"); // NOI18N
        itemDetailsMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemDetailsMenuItemActionPerformed(evt);
            }
        });
        itemMenu.add(itemDetailsMenuItem);

        itemSellingPriceChangeMenuItem.setText("Selling Price Change");
        itemSellingPriceChangeMenuItem.setName("itemSellingPriceChangeMenuItem"); // NOI18N
        itemSellingPriceChangeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemSellingPriceChangeMenuItemActionPerformed(evt);
            }
        });
        itemMenu.add(itemSellingPriceChangeMenuItem);

        repPriceChangeMenuItem.setText("Rep Price Change");
        repPriceChangeMenuItem.setName("repPriceChangeMenuItem"); // NOI18N
        repPriceChangeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repPriceChangeMenuItemActionPerformed(evt);
            }
        });
        itemMenu.add(repPriceChangeMenuItem);

        itemCostPriceChangeMenuItem.setText("Cost Price Change");
        itemCostPriceChangeMenuItem.setName("itemCostPriceChangeMenuItem"); // NOI18N
        itemCostPriceChangeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemCostPriceChangeMenuItemActionPerformed(evt);
            }
        });
        itemMenu.add(itemCostPriceChangeMenuItem);

        itemTypeMenuItem.setText("Item Type");
        itemTypeMenuItem.setName("itemTypeMenuItem"); // NOI18N
        itemTypeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemTypeMenuItemActionPerformed(evt);
            }
        });
        itemMenu.add(itemTypeMenuItem);

        menuBar.add(itemMenu);

        reportMenu.setText("Report");
        reportMenu.setName("reportMenu"); // NOI18N

        stockTransferReportMenuItem.setText("Stock Transfer Report");
        stockTransferReportMenuItem.setName("stockTransferReportMenuItem"); // NOI18N
        stockTransferReportMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stockTransferReportMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(stockTransferReportMenuItem);

        repSalesReportMenuItem.setText("Rep Sales Report");
        repSalesReportMenuItem.setName("repSalesReportMenuItem"); // NOI18N
        repSalesReportMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                repSalesReportMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(repSalesReportMenuItem);

        stockChangeReportMenuItem.setText("Stock Change Report");
        stockChangeReportMenuItem.setName("stockChangeReportMenuItem"); // NOI18N
        stockChangeReportMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stockChangeReportMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(stockChangeReportMenuItem);

        purchaseSummaryMenuItem.setText("Purchase Summary");
        purchaseSummaryMenuItem.setName("purchaseSummaryMenuItem"); // NOI18N
        purchaseSummaryMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                purchaseSummaryMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(purchaseSummaryMenuItem);

        salesSummaryMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F7, 0));
        salesSummaryMenuItem.setText("Sales Summary");
        salesSummaryMenuItem.setName("salesSummaryMenuItem"); // NOI18N
        salesSummaryMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salesSummaryMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(salesSummaryMenuItem);

        paymentSummaryMenuItem.setText("Payment Summary");
        paymentSummaryMenuItem.setName("paymentSummaryMenuItem"); // NOI18N
        paymentSummaryMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                paymentSummaryMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(paymentSummaryMenuItem);

        expensesReportMenuItem.setText("Expenses Report");
        expensesReportMenuItem.setName("expensesReportMenuItem"); // NOI18N
        expensesReportMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                expensesReportMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(expensesReportMenuItem);

        collectionSummaryMenuItem.setText("Collection Summary");
        collectionSummaryMenuItem.setName("collectionSummaryMenuItem"); // NOI18N
        collectionSummaryMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                collectionSummaryMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(collectionSummaryMenuItem);

        averagePriceMenuItem.setText("Average Price");
        averagePriceMenuItem.setName("averagePriceMenuItem"); // NOI18N
        averagePriceMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                averagePriceMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(averagePriceMenuItem);

        damageNotesMenuItem.setText("Damage Notes");
        damageNotesMenuItem.setName("damageNotesMenuItem"); // NOI18N
        damageNotesMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                damageNotesMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(damageNotesMenuItem);

        issuedChequeReportMenuItem.setText("Issued Cheque");
        issuedChequeReportMenuItem.setName("issuedChequeReportMenuItem"); // NOI18N
        issuedChequeReportMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                issuedChequeReportMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(issuedChequeReportMenuItem);

        receivedChequeReportMenuItem.setText("Received Cheque");
        receivedChequeReportMenuItem.setName("receivedChequeReportMenuItem"); // NOI18N
        receivedChequeReportMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                receivedChequeReportMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(receivedChequeReportMenuItem);

        itemMovementsMenuItem.setText("Item Movements");
        itemMovementsMenuItem.setName("itemMovementsMenuItem"); // NOI18N
        itemMovementsMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                itemMovementsMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(itemMovementsMenuItem);

        saleProfitMenuItem.setText("Sale Profit");
        saleProfitMenuItem.setName("saleProfitMenuItem"); // NOI18N
        saleProfitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                saleProfitMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(saleProfitMenuItem);

        profitSummeryMenuItem.setText("Profit Summery");
        profitSummeryMenuItem.setName("profitSummeryMenuItem"); // NOI18N
        profitSummeryMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                profitSummeryMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(profitSummeryMenuItem);

        monthMenuItem.setText("Month");
        monthMenuItem.setName("monthMenuItem"); // NOI18N
        monthMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                monthMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(monthMenuItem);

        printInvoiceMenuItem.setText("Print Invoice");
        printInvoiceMenuItem.setName("printInvoiceMenuItem"); // NOI18N
        printInvoiceMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                printInvoiceMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(printInvoiceMenuItem);

        partPaymentCollectionReportMenuItem.setText("Part Payment Collection");
        partPaymentCollectionReportMenuItem.setName("partPaymentCollectionReportMenuItem"); // NOI18N
        partPaymentCollectionReportMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                partPaymentCollectionReportMenuItemActionPerformed(evt);
            }
        });
        reportMenu.add(partPaymentCollectionReportMenuItem);

        menuBar.add(reportMenu);

        commonMenu.setText("Common");
        commonMenu.setName("commonMenu"); // NOI18N

        supplierMenuItem.setText("Supplier");
        supplierMenuItem.setName("supplierMenuItem"); // NOI18N
        supplierMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                supplierMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(supplierMenuItem);

        subDealerMenuItem.setText("Sub Dealer");
        subDealerMenuItem.setName("subDealerMenuItem"); // NOI18N
        subDealerMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                subDealerMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(subDealerMenuItem);

        ExpensesPayMenuItem.setText("Expenses Pay");
        ExpensesPayMenuItem.setName("ExpensesPayMenuItem"); // NOI18N
        ExpensesPayMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ExpensesPayMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(ExpensesPayMenuItem);

        customerMenuItem.setText("Customer");
        customerMenuItem.setName("customerMenuItem"); // NOI18N
        customerMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                customerMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(customerMenuItem);

        employeeMenuItem.setText("Employee");
        employeeMenuItem.setName("employeeMenuItem"); // NOI18N
        employeeMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                employeeMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(employeeMenuItem);

        employeePositionMenuItem.setText("Employee Position");
        employeePositionMenuItem.setName("employeePositionMenuItem"); // NOI18N
        employeePositionMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                employeePositionMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(employeePositionMenuItem);

        bankMenuItem.setText("Bank");
        bankMenuItem.setName("bankMenuItem"); // NOI18N
        bankMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bankMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(bankMenuItem);

        townMenuItem.setText("Town");
        townMenuItem.setName("townMenuItem"); // NOI18N
        townMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                townMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(townMenuItem);

        rootAreaMenuItem.setText("Root");
        rootAreaMenuItem.setName("rootAreaMenuItem"); // NOI18N
        rootAreaMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rootAreaMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(rootAreaMenuItem);

        operatorMenuItem.setText("Operator");
        operatorMenuItem.setName("operatorMenuItem"); // NOI18N
        operatorMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                operatorMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(operatorMenuItem);

        permissionMenuItem.setText("Permission");
        permissionMenuItem.setName("permissionMenuItem"); // NOI18N
        permissionMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                permissionMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(permissionMenuItem);

        menuManageMenuItem.setText("Menu Manage");
        menuManageMenuItem.setName("menuManageMenuItem"); // NOI18N
        menuManageMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuManageMenuItemActionPerformed(evt);
            }
        });
        commonMenu.add(menuManageMenuItem);

        menuBar.add(commonMenu);

        setJMenuBar(menuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap(882, Short.MAX_VALUE)
                .addComponent(detailsLabel))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(statusMessageLabel)
                        .addGap(0, 872, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(leftPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(mainPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(statusMessageLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(detailsLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(mainPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(leftPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addContainerGap())))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void townMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_townMenuItemActionPerformed
        TownView.display();
    }//GEN-LAST:event_townMenuItemActionPerformed

    private void supplierMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_supplierMenuItemActionPerformed
        SupplierView.display();
    }//GEN-LAST:event_supplierMenuItemActionPerformed

    private void itemDetailsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemDetailsMenuItemActionPerformed
        ItemView.display();
    }//GEN-LAST:event_itemDetailsMenuItemActionPerformed

    private void purchaseInvoiceMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_purchaseInvoiceMenuItemActionPerformed
        PurchaseInvoiceView.display();
    }//GEN-LAST:event_purchaseInvoiceMenuItemActionPerformed

    private void saleInvoiceMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saleInvoiceMenuItemActionPerformed
        SaleInvoiceView.display();
    }//GEN-LAST:event_saleInvoiceMenuItemActionPerformed

    private void customerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_customerMenuItemActionPerformed
        CustomerView.display();
    }//GEN-LAST:event_customerMenuItemActionPerformed

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        exiting();
    }//GEN-LAST:event_exitMenuItemActionPerformed

    private void saleInvoicePaymentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saleInvoicePaymentMenuItemActionPerformed
        SaleInvoicePaymentView.display();
    }//GEN-LAST:event_saleInvoicePaymentMenuItemActionPerformed

    private void bankMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bankMenuItemActionPerformed
        BankView.display();
    }//GEN-LAST:event_bankMenuItemActionPerformed

    private void purchaseInvoicePaymentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_purchaseInvoicePaymentMenuItemActionPerformed
        PurchaseInvoicePaymentView.display();
    }//GEN-LAST:event_purchaseInvoicePaymentMenuItemActionPerformed

    private void employeeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_employeeMenuItemActionPerformed
        EmployeeView.display();
    }//GEN-LAST:event_employeeMenuItemActionPerformed

    private void employeePositionMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_employeePositionMenuItemActionPerformed
        EmployeePositionView.display();
    }//GEN-LAST:event_employeePositionMenuItemActionPerformed

    private void repStockMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repStockMenuItemActionPerformed
        RepStockView.display();
    }//GEN-LAST:event_repStockMenuItemActionPerformed

    private void stockStatusMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stockStatusMenuItemActionPerformed
        StockView.display();
    }//GEN-LAST:event_stockStatusMenuItemActionPerformed

    private void stockTransferMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stockTransferMenuItemActionPerformed
        StockTransferView.display();
    }//GEN-LAST:event_stockTransferMenuItemActionPerformed

    private void stockTransferReportMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stockTransferReportMenuItemActionPerformed
        TransferReportView.display();
    }//GEN-LAST:event_stockTransferReportMenuItemActionPerformed

    private void repRemainingStockMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repRemainingStockMenuItemActionPerformed
        RepRemainingStockView.display();
    }//GEN-LAST:event_repRemainingStockMenuItemActionPerformed

    private void repSalesReportMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repSalesReportMenuItemActionPerformed
        RepSaleReportView.display();
    }//GEN-LAST:event_repSalesReportMenuItemActionPerformed

    private void stockChangeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stockChangeMenuItemActionPerformed
        StockChangeView.display();
    }//GEN-LAST:event_stockChangeMenuItemActionPerformed

    private void stockChangeReportMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stockChangeReportMenuItemActionPerformed
        StockChangeReportView.display();
    }//GEN-LAST:event_stockChangeReportMenuItemActionPerformed

    private void itemSellingPriceChangeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemSellingPriceChangeMenuItemActionPerformed
        SelingPriceChangeView.display();
    }//GEN-LAST:event_itemSellingPriceChangeMenuItemActionPerformed

    private void rootAreaMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rootAreaMenuItemActionPerformed
        RootAreaView.display();
    }//GEN-LAST:event_rootAreaMenuItemActionPerformed

    private void subDealerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subDealerMenuItemActionPerformed
        SubDealerView.display();
    }//GEN-LAST:event_subDealerMenuItemActionPerformed

    private void repStockChangeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repStockChangeMenuItemActionPerformed
        RepStockChangeView.display();
    }//GEN-LAST:event_repStockChangeMenuItemActionPerformed

    private void purchaseSummaryMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_purchaseSummaryMenuItemActionPerformed
        PurchaseReportView.display();
    }//GEN-LAST:event_purchaseSummaryMenuItemActionPerformed

    private void repPriceChangeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repPriceChangeMenuItemActionPerformed
        RepPriceChangeView.display();
    }//GEN-LAST:event_repPriceChangeMenuItemActionPerformed

    private void averagePriceMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_averagePriceMenuItemActionPerformed
        AveragePriceView.display();
    }//GEN-LAST:event_averagePriceMenuItemActionPerformed

    private void operatorMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_operatorMenuItemActionPerformed
        OperatorView.display();
    }//GEN-LAST:event_operatorMenuItemActionPerformed

    private void repSalesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repSalesMenuItemActionPerformed
        RepSaleView.display();
    }//GEN-LAST:event_repSalesMenuItemActionPerformed

    private void repStockReturnMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_repStockReturnMenuItemActionPerformed
        RepReturnView.display();
    }//GEN-LAST:event_repStockReturnMenuItemActionPerformed

    private void damageStockMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_damageStockMenuItemActionPerformed
        DamageStockView.display();
    }//GEN-LAST:event_damageStockMenuItemActionPerformed

    private void damageNotesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_damageNotesMenuItemActionPerformed
        DamageNotesView.display();
    }//GEN-LAST:event_damageNotesMenuItemActionPerformed

    private void companyMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_companyMenuItemActionPerformed
        CompanyView.display();
    }//GEN-LAST:event_companyMenuItemActionPerformed

    private void salesSummaryMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salesSummaryMenuItemActionPerformed
        SalesReportView.display();
    }//GEN-LAST:event_salesSummaryMenuItemActionPerformed

    private void paymentSummaryMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paymentSummaryMenuItemActionPerformed
        PaymentReportView.display();
    }//GEN-LAST:event_paymentSummaryMenuItemActionPerformed

    private void permissionMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_permissionMenuItemActionPerformed
        PermissionView.display();
    }//GEN-LAST:event_permissionMenuItemActionPerformed

    private void collectionSummaryMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_collectionSummaryMenuItemActionPerformed
        CollectionReportView.display();
    }//GEN-LAST:event_collectionSummaryMenuItemActionPerformed

    private void issuedChequeReportMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_issuedChequeReportMenuItemActionPerformed
        IssuedChequeReportView.display();
    }//GEN-LAST:event_issuedChequeReportMenuItemActionPerformed

    private void receivedChequeReportMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_receivedChequeReportMenuItemActionPerformed
        ReceivedChequeReportView.display();
    }//GEN-LAST:event_receivedChequeReportMenuItemActionPerformed

    private void menuManageMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuManageMenuItemActionPerformed
        MenuManageView.display();
    }//GEN-LAST:event_menuManageMenuItemActionPerformed

    private void itemMovementsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemMovementsMenuItemActionPerformed
        ItemMovementView.display();
    }//GEN-LAST:event_itemMovementsMenuItemActionPerformed

    private void ExpensesPayMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ExpensesPayMenuItemActionPerformed
        ExpensesPayView.display();
    }//GEN-LAST:event_ExpensesPayMenuItemActionPerformed

    private void saleProfitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saleProfitMenuItemActionPerformed
        ProfitView.display();
    }//GEN-LAST:event_saleProfitMenuItemActionPerformed

    private void profitSummeryMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_profitSummeryMenuItemActionPerformed
        ProfitSummeryView.display();
    }//GEN-LAST:event_profitSummeryMenuItemActionPerformed

    private void expensesReportMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_expensesReportMenuItemActionPerformed
        ExpensesReportView.display();
    }//GEN-LAST:event_expensesReportMenuItemActionPerformed

    private void itemCostPriceChangeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemCostPriceChangeMenuItemActionPerformed
        CostPriceChangeView.display();
    }//GEN-LAST:event_itemCostPriceChangeMenuItemActionPerformed

    private void monthMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_monthMenuItemActionPerformed
        MonthReportView.display();
    }//GEN-LAST:event_monthMenuItemActionPerformed

    private void printInvoiceMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printInvoiceMenuItemActionPerformed
        FindInvoiceView.display();
    }//GEN-LAST:event_printInvoiceMenuItemActionPerformed

    private void partPaymentCollectionReportMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_partPaymentCollectionReportMenuItemActionPerformed
        PartPaymentCollectionReportView.display();
    }//GEN-LAST:event_partPaymentCollectionReportMenuItemActionPerformed

    private void posMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_posMenuItemActionPerformed
        POS.display();
    }//GEN-LAST:event_posMenuItemActionPerformed

    private void itemTypeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_itemTypeMenuItemActionPerformed
        ItemTypeView.display();
    }//GEN-LAST:event_itemTypeMenuItemActionPerformed
    public void setVisible() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                MainView.getInstance().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem ExpensesPayMenuItem;
    private javax.swing.JMenuItem averagePriceMenuItem;
    private javax.swing.JMenuItem bankMenuItem;
    private javax.swing.JPanel cLogoPanel;
    private javax.swing.JMenuItem collectionSummaryMenuItem;
    private javax.swing.JMenu commonMenu;
    private javax.swing.JMenuItem companyMenuItem;
    private javax.swing.JMenuItem customerMenuItem;
    private javax.swing.JMenuItem damageNotesMenuItem;
    private javax.swing.JMenuItem damageStockMenuItem;
    private javax.swing.JMenu destributionMenu;
    private javax.swing.JLabel detailsLabel;
    private javax.swing.JMenuItem employeeMenuItem;
    private javax.swing.JMenuItem employeePositionMenuItem;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenuItem expensesReportMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenuItem issuedChequeReportMenuItem;
    private javax.swing.JMenuItem itemCostPriceChangeMenuItem;
    private javax.swing.JMenuItem itemDetailsMenuItem;
    private javax.swing.JMenu itemMenu;
    private javax.swing.JMenuItem itemMovementsMenuItem;
    private javax.swing.JMenuItem itemSellingPriceChangeMenuItem;
    private javax.swing.JMenuItem itemTypeMenuItem;
    private javax.swing.JPanel leftPanel;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem menuManageMenuItem;
    private javax.swing.JMenuItem monthMenuItem;
    public static javax.swing.JLabel operatorLabel;
    public static javax.swing.JLabel operatorLabel1;
    private javax.swing.JMenuItem operatorMenuItem;
    private javax.swing.JMenuItem partPaymentCollectionReportMenuItem;
    private javax.swing.JMenuItem paymentSummaryMenuItem;
    private javax.swing.JMenuItem permissionMenuItem;
    private javax.swing.JMenuItem posMenuItem;
    private javax.swing.JMenuItem printInvoiceMenuItem;
    private javax.swing.JMenuItem profitSummeryMenuItem;
    private javax.swing.JMenuItem purchaseInvoiceMenuItem;
    private javax.swing.JMenuItem purchaseInvoicePaymentMenuItem;
    private javax.swing.JMenu purchaseMenu;
    private javax.swing.JMenuItem purchaseSummaryMenuItem;
    private javax.swing.JMenuItem receivedChequeReportMenuItem;
    private javax.swing.JMenuItem repPriceChangeMenuItem;
    private javax.swing.JMenuItem repRemainingStockMenuItem;
    private javax.swing.JMenuItem repSalesMenuItem;
    private javax.swing.JMenuItem repSalesReportMenuItem;
    private javax.swing.JMenuItem repStockChangeMenuItem;
    private javax.swing.JMenuItem repStockMenuItem;
    private javax.swing.JMenuItem repStockReturnMenuItem;
    private javax.swing.JMenu reportMenu;
    private javax.swing.JMenuItem rootAreaMenuItem;
    private javax.swing.JMenuItem saleInvoiceMenuItem;
    private javax.swing.JMenuItem saleInvoicePaymentMenuItem;
    private javax.swing.JMenuItem saleProfitMenuItem;
    private javax.swing.JMenu salesMenu;
    private javax.swing.JMenuItem salesSummaryMenuItem;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JMenuItem stockChangeMenuItem;
    private javax.swing.JMenuItem stockChangeReportMenuItem;
    private javax.swing.JMenu stockMenu;
    private javax.swing.JMenuItem stockStatusMenuItem;
    private javax.swing.JMenuItem stockTransferMenuItem;
    private javax.swing.JMenuItem stockTransferReportMenuItem;
    private javax.swing.JMenuItem subDealerMenuItem;
    private javax.swing.JMenuItem supplierMenuItem;
    private javax.swing.JMenuItem townMenuItem;
    // End of variables declaration//GEN-END:variables

    private void menuItemManage() {
        boolean b = false;
        stockTransferMenuItem.setVisible(b);
        subDealerMenuItem.setVisible(b);
        stockTransferReportMenuItem.setVisible(b);
        repStockMenuItem.setVisible(b);
        repRemainingStockMenuItem.setVisible(b);
        repSalesMenuItem.setVisible(b);
        repStockChangeMenuItem.setVisible(b);
        repStockReturnMenuItem.setVisible(b);
        repPriceChangeMenuItem.setVisible(b);
        repSalesReportMenuItem.setVisible(b);
        damageStockMenuItem.setVisible(b);
        damageNotesMenuItem.setVisible(b);
        averagePriceMenuItem.setVisible(b);
    }

    /**
     * @return the statusMessageLabel
     */
    @Override
    public javax.swing.JLabel getStatusMessageLabel() {
        return statusMessageLabel;
    }

    @Override
    protected JLabel getDetailsLabel() {
        return detailsLabel;
    }

    @Override
    protected String getUsername() {
        Operator operator = util.Data.getOperator();
        return operator == null ? "Anonymous" : operator.getUsername();
    }

    @Override
    public void setVisible(boolean b) {
        super.setVisible(b);
        if (m.find(ViewPanel.class).isEmpty()) {
            Init.views();
        }
        POS.display();
    }

    public void menuRegister() {
        m.clearCache();
        int menuCount = menuBar.getMenuCount();
        for (int i = 0; i < menuCount; i++) {
            JMenu jMenu = menuBar.getMenu(i);
            String menuName = jMenu.getName();
            Menu menu = m.find(Menu.class, menuName);
            if (menu == null) {
                menu = new Menu(menuName);
                menu.setStatus(1);
                m.update(menu);
                menu = m.find(Menu.class, menuName);
            } else {
                jMenu.setVisible(menu.getStatus() == 1);
            }
            for (int ii = 0; ii < jMenu.getMenuComponentCount(); ii++) {
                Component component = jMenu.getMenuComponent(ii);
                String componentName = component.getName();
                MenuItemPK menuItemPK = new MenuItemPK(menuName, componentName);
                MenuItem menuItem = m.find(MenuItem.class, menuItemPK);
                if (menuItem == null) {
                    menuItem = new MenuItem(menuItemPK);
                    menuItem.setMenu(menu);
                    menuItem.setStatus(1);
                    m.update(menuItem);
                } else {
                    component.setVisible(menuItem.getStatus() == 1);
                }
            }
        }
    }
}
